package com.alks.function.controller.stockdept.pcfactorystockquery;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.stockdept.pcfactorystockwork.*;
import com.alks.function.service.stockdept.pcfactorystockquery.IPcOtherMtlInService;
import com.alks.function.service.stockdept.pcfactorystockquery.IPcOtherMtlOutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@ApiRestController("/pcFactorStockQuery")
@Api(value = "仓储部查询", tags = "仓储部-仓储工厂作业-其他出库作业")
@Slf4j
@RoleCheck(prgIds = {"120110"})
public class PcOtherMtlOutController {
    @Autowired
    IPcOtherMtlInService inService;
    @Autowired
    IPcOtherMtlOutService outService;

    @PostMapping("/getOtherMtlOutDtlQuery2")
    @ApiOperation(value = "其他出库作业-待出库明细-查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getOtherMtlOutDtlQuery2() {
        return outService.getOtherMtlOutDtlQuery2();
    }

    @PutMapping("/getOtherMtlOutSubQuery2")
    @ApiOperation(value = "其他出库作业-替代材料查询-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getOtherMtlOutSubQuery2(@RequestBody DrawActMtlRequest request) {
        return outService.getOtherMtlOutSubQuery2(request);
    }

    @PutMapping("/getOtherMtlOutQuery2")
    @ApiOperation(value = "其他出库作业-出库明细-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getOtherMtlOutQuery2(@RequestBody OMtlWatiRequest request) {
        return inService.getOtherMtlInQuery(request,"O");
    }


    @PutMapping("/getLotComMtlQuery2")
    @ApiOperation(value = "其他出库作业-通用材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getLotComMtlQuery2(@RequestBody LotComMtlRequest request) {
        return inService.getLotComMtlQuery(request);
    }

    @PutMapping("/getLotMtlQuery2")
    @ApiOperation(value = "其他出库作业-指令材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getLotMtlQuery2(@RequestBody LotMtlRequest request) {
        return inService.getLotMtlQuery(request,0);
    }

    @PutMapping("/getStyMtlQuery2")
    @ApiOperation(value = "其他出库作业-型体材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getStyMtlQuery2(@RequestBody StyMtlRequest request) {
        return outService.getStyMtlQuery2(request);
    }

    @PostMapping("/otherLotSubMtlQuery2")
    @ApiOperation(value = "其他出库作业-贴合子材料-条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo otherLotSubMtlQuery2(@RequestParam String mtlNo) {
        return outService.otherLotSubMtlQuery2(mtlNo);
    }

    @PutMapping("/getComMtlQuery2")
    @ApiOperation(value = "其他出库作业-材料库-分页可条件查询", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo getComMtlQuery2(@RequestBody ComMtlRequest request) {
        return inService.getComMtlQuery(request);
    }


//    --
    @PutMapping("/otherMtlWaitStockAdd2")
    @ApiOperation(value = "其他出库作业-待出库新增-新增", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo otherMtlWaitStockAdd2(@RequestBody List<OMtlwaitAddRequest> request,
                                             @RequestParam @ApiParam("类型（1.通用 2.指令 3.型体 4.材料库）") Integer type) {
        return outService.otherMtlWaitStockAdd2(request, type);
    }

    @PutMapping("/otherMtlWaitStockUpdate2")
    @ApiOperation(value = "其他出库作业-待出库数据修改-修改", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo otherMtlWaitStockUpdate2(@RequestBody List<OMtlWatiUpRequest> request) {
        return inService.otherMtlWaitStockUpdate(request,"O");
    }


    @PutMapping("/otherMtlOutStockAdd2")
    @ApiOperation(value = "其他出库作业-出库批处理-新增", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo otherMtlOutStockAdd2(@RequestBody OMtlInAddRequest request) {
        return inService.otherMtlInStockAdd(request,"O");
    }

    @PostMapping("/otherMtlOutStockDelete2")
    @ApiOperation(value = "其他出库作业-整单删除-删除", tags = "仓储部-仓储工厂作业-其他出库作业")
    public ResponseInfo otherMtlOutStockDelete2(@RequestParam @ApiParam("出库单号") String slipNo) {
        return inService.otherMtlStockDelete(slipNo, "O");

    }

}
